package com.d3works.apps.bpm.service.execution;

import com.d3works.apps.bpm.db.WkfInstance;
import com.d3works.apps.bpm.db.WkfProcess;
import com.d3works.apps.bpm.db.WkfTaskConfig;
import com.d3works.db.Model;
import com.d3works.exception.D3worksException;
import com.d3works.meta.CallMethod;
import com.google.inject.persist.Transactional;
import java.util.List;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;

public interface WkfInstanceService {

  @Transactional
  public String evalInstance(Model model, String signal)
      throws ClassNotFoundException, D3worksException;

  @Transactional
  public WkfInstance createWkfInstance(String processInstanceId, WkfProcess wkfProcess);

  public boolean isActiveProcessInstance(String processInstanceId, RuntimeService runTimeService);

  public void deleteProcessInstance(String processInstanceId);

  @CallMethod
  public boolean isActiveTask(String processInstanceId, String taskId);

  @CallMethod
  public List<String> findProcessInstanceByNode(
      String nodeKey, String processId, String type, boolean permanent);

  public void onNodeActivation(WkfTaskConfig wkfTaskConfig, DelegateExecution execution);

  public void terminateAll();

  public String getInstanceXml(String instanceId);

  public boolean isActivatedTask(String processInstanceId, String taskId);

  public void restart(String processInstanceId, String activityId);

  public List<String> getNodes(String processInstanceId);

  public void cancelNode(String processInstanceId, String activityId);
}
